<script lang="ts" setup>
import { useAppStore } from '@/store'

const { enableDebug } = storeToRefs(useAppStore())
function goEnv() {
  uni.navigateTo({
    url: '/pages/setting/env',
  })
}
const enabled = ref(enableDebug.value)
function change(value: boolean) {
  wx.setEnableDebug({
    enableDebug: value,
  })
}
</script>

<template>
  <div class="setting">
    <nut-cell-group>
      <nut-cell title="环境选择" is-link @click="goEnv">
        <template #icon>
          <image class="icon" src="/static/ico/1.png" />
        </template>
      </nut-cell>
      <nut-cell title="调试控制台">
        <template #icon>
          <image class="icon" src="/static/ico/2.png" />
        </template>
        <template #link>
          <nut-switch v-model="enabled" @change="change" />
        </template>
      </nut-cell>
    </nut-cell-group>
  </div>
</template>

<route lang="json">
{
  "style": {
    "navigationBarTitleText": "商户申请",
    "backgroundColorContent": "#f1f1f1"
  }
}
</route>

<style lang="sass" scoped>
.setting
  padding: 20px
  .icon
    width: 20px
    height: 20px
    margin-right: 5px
</style>
